<?php
	$this->headScript()->appendFile(HTTP_HOST.'/js/photos.js');
	$this->headScript()->appendFile(HTTP_HOST.'/js/jQuery/jquery.lightbox-0.5.min.js');
	$this->headLink()->appendStylesheet(HTTP_HOST.'/css/jquery/lightbox/jquery.lightbox-0.5.css');
	$this->headScript()->captureStart();
	?>
	var _txt_image = '<?=_('Фото')?>';
	var _txt_of = '<?=_('из')?>';
		<?php foreach ($this->object['images'] as $v) { ?>
			thumbImages[<?=$v['ID']?>] = new Image();
			thumbImages[<?=$v['ID']?>].src = '<?=Obj_Image::thumbnail($v, 76, 76)?>';
			bigImages[<?=$v['ID']?>] = new Image();
			bigImages[<?=$v['ID']?>].src = '<?=Obj_Image::thumbnail($v, 495)?>';
			hugeImages[<?=$v['ID']?>] = '<?=Obj_Image::thumbnail($v, 800)?>';
			PHOTOS_COUNT++;
		<?php } ?>
		$(document).ready(function() {
			initGallery('bigphoto', 'sliderlist');
		});
	<?php 
	$this->headScript()->captureEnd();
?>			
			<div class="_obj_obj_title"><?=stripslashes($this->object['Name'])?></div>
			<div class="_obj_obj_back"><a href="javascript:history.back();"><?=$this->translate('назад')?></a></div>
			<div class="clear"></div>
			<div class="_obj_breadscrumb"><a href="<?=HTTP_HOST?>/<?=$this->object['CountryAlias']?>"><?=$this->object['CountryName']?></a> | <a href="<?=HTTP_HOST?>/<?=$this->object['CountryAlias']?>/<?=$this->object['RegionAlias']?>"><?=$this->object['RegionName']?></a> | <a href="<?=HTTP_HOST?>/<?=$this->object['CountryAlias']?>/<?=$this->object['RegionAlias']?>/<?=$this->object['CityAlias']?>"><?=$this->object['CityName']?></a></div>
			<?php
				$price = array();
				if (intval($this->object['Price']) !== 0) $price[] = str_replace('%', number_format($this->object['Price'], 0, '.', ' '), $this->{'SIGN_'.$this->object['Сurrency']});
				if (intval($this->object['PriceTo']) !== 0) $price[] = str_replace('%', number_format($this->object['PriceTo'], 0, '.', ' '), $this->{'SIGN_'.$this->object['Сurrency']});
				$price = array_unique($price);
				if (empty($price)) throw new Zend_Exception('PRICE_ERROR');
				
				$square = array();
				if (intval($this->object['Area']) !== 0) $square[] = $this->object['Area'].' '.$this->translate('м<sup>2</sup>');
				if (intval($this->object['AreaTo']) !== 0) $square[] = $this->object['AreaTo'].' '.$this->translate('м<sup>2</sup>');
				$square = array_unique($square);
				if (empty($square)) $square[] = '';
			?>
			<div class="_obj_square"><?=$this->translate('Площадь')?>: <span><?=implode(' - ', $square)?></span></div>
			<div class="_obj_price"><?=$this->translate('Цена')?>: <span><?=implode(' - ', $price)?></span></div>
			<div class="clear"></div>
			<div class="obj_det_tabs">
				<a class="active photo" href="javascript:;"><?=$this->translate('Фото')?></a>
				<a class="video" href="javascript:;"><?=$this->translate('Видео')?></a>
				<a class="panorama" href="javascript:;"><?=$this->translate('Панорама')?></a>
			</div>
			<?php if (sizeof($this->object['images']) > 0) { ?>
			<div id="mediaphoto">
				<div class="objtype">
					<img src="<?=HTTP_HOST?>/images/aurora/<?=$this->objtypefile?>" alt="" />
				</div>
				<div class="bigphoto">
					<img id="bigphoto" alt="" />
					<img src="<?=HTTP_HOST?>/images/aurora/country_template/empty.gif" alt="" class="cover"/>
				<div class="bphslider">
					<a class="left" href="javascript:;"><span>&nbsp;</span></a>
					<a class="right" href="javascript:;"><span>&nbsp;</span></a>
				</div>
				</div>
			</div>
			<div class="galinfo">
				<div class="phnumber">
					<?=_('Фото')?> <span id="phnumber">1</span> <?=_('из')?> <span id="phcount"></span>
				</div>
				<div class="hugephotos">
					<a href="javascript:;" id="showhugephotos"><?=_('Большие фото')?></a>
					<div id="hugephotos"></div>
				</div>
				<div class="clear"></div>
			</div>
			<div class="_obj_gallery_items">
				<div class="slideleft"><span>&nbsp;</span></div>
				<div class="slideright"><span>&nbsp;</span></div>
				<div class="sliderlist" id="sliderlist"></div>
				<?php /* foreach ($this->object['images'] as $v) { ?>
					<div class="_obj_item_photo"><a href="javascript:;" rel="<?=Obj_Image::thumbnail($v, 495)?>"><img src="<?=Obj_Image::thumbnail($v, 80, 80)?>" alt=""/></a></div>
				<?php }*/ ?>
			</div>
			<?php } ?>
			<div id="object_data_params">
				<table id="main_settings" border="0" cellspacing="0" cellpadding="0">
					<tr><td colspan="2" class="txt"><h4><?=$this->translate('Параметры')?></h4></td></tr>
					<tr><td class="txt"><?=$this->translate('Тип объекта: ').'</td><td>'.$this->object['Object_type']['Name']; ?></td></tr>
					<?=($this->object['DistanceToSea'] > 0 && is_int((int)$this->object['DistanceToSea']))?'<tr><td class="txt">'.$this->translate('Расстояние до моря: ').'</td><td>'.$this->object['DistanceToSea'].$this->translate(' м.').'</td></tr>':'';?>
					<?=($this->object['DistanceToAirport'] > 0 && is_int((int)$this->object['DistanceToAirport']))?'<tr><td class="txt">'.$this->translate('Расстояние до аэропорта: ').'</td><td>'.$this->object['DistanceToAirport'].$this->translate(' км.').'</td></tr>':''; ?>
					<?=($this->object['YearOfConstruction'] > 0 && is_int((int)$this->object['YearOfConstruction']))?'<tr><td class="txt">'.$this->translate('Год постройки: ').'</td><td>'.$this->object['YearOfConstruction'].'</td></tr>':''; ?>
					<?=($this->object['Floor'] > 0 && is_int((int)$this->object['Floor']))?'<tr><td class="txt">'.$this->translate('Кол-во этажей объекта: ').'</td><td>'.$this->object['Floor'].'</td></tr>':''; ?>
					<?=($this->object['NumberOfBedrooms'] > 0 && is_int((int)$this->object['NumberOfBedrooms']))?'<tr><td class="txt">'.$this->translate('Кол-во спален: ').'</td><td>'.$this->object['NumberOfBedrooms'].'</td></tr>':''; ?>
					<?=($this->object['NumberOfBathrooms'] > 0 && is_int((int)$this->object['NumberOfBathrooms']))?'<tr><td class="txt">'.$this->translate('Кол-во ванных комнат: ').'</td><td>'.$this->object['NumberOfBathrooms'].'</td></tr>':''; ?>
				</table>
				<table id="secondary_settings">
					<tr><td colspan="2"><h4><?=$this->translate('Дополнительные удобства')?></h4></td></tr>
					<?=($this->object['SwimmingPool'] == 1 && is_int((int)$this->object['SwimmingPool']))?'<tr><td>'.$this->translate('Бассейн'):'';?>
					<?=($this->object['Parking'] == 1 && is_int((int)$this->object['Parking']))?'<tr><td>'.$this->translate('Паркинг'):'';?>
					<?=($this->object['Security'] == 1 && is_int((int)$this->object['Security']))?'<tr><td>'.$this->translate('Охрана'):'';?>
					<?=($this->object['Elevator'] == 1 && is_int((int)$this->object['Elevator']))?'<tr><td>'.$this->translate('Лифт'):'';?>
					<?=($this->object['ChildrensPool'] == 1 && is_int((int)$this->object['ChildrensPool']))?'<tr><td>'.$this->translate('Детский бассейн'):'';?>
					<?=($this->object['Playground'] == 1 && is_int((int)$this->object['Playground']))?'<tr><td>'.$this->translate('Детская площадка'):'';?>
					<?=($this->object['Heating'] == 1 && is_int((int)$this->object['Heating']))?'<tr><td>'.$this->translate('Отопление'):'';?>
					<?=($this->object['HotWater'] == 1 && is_int((int)$this->object['HotWater']))?'<tr><td>'.$this->translate('Горячая вода'):'';?>
				</table>
				<div class="clear"></div>
			</div>
			<div class="dec_title"><?=$this->translate('Описание объекта')?>:</div>
			<div class="_obj_desc">
				<?=stripslashes($this->object['FullDescription']);?>
			</div>
			<div class="_obj_obj_back2"><a href="javascript:history.back();"><?=$this->translate('вернуться к списку объектов')?></a></div>